package com.tiancheng.trade.settlement.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Auther: wangxin
 * @Date: 2024/4/27 10:13
 * @Param ${tags}
 * @Description:0：正常，1：异常,2:我方有银行无,3:银行有我方无
 */
@Getter
@AllArgsConstructor
public enum SettlementBillStatusEnum {
    SUCCESS("0", "正常"),
    ABNORMAL("1", "数据异常"),
    BANK_NOT_MATCH("2", "我方有银行无"),
    PLATFORM_NOT_MATCH("3", "银行有我方无");
    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<SettlementBillStatusEnum> found = Arrays.stream(SettlementBillStatusEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
